<?php

use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddDeviceAndCountryToUsers extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->unsignedTinyInteger('device')->default(User::UNKNOWN)->comment('设备:0=未知,1=安卓,2=ios,3=h5')->after('invite_starttime');
            $table->string('device_number')->default('')->comment('设备码')->after('invite_starttime');
            $table->string('country')->default('')->comment('国家')->after('invite_starttime');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('device');
            $table->dropColumn('device_number');
            $table->dropColumn('country');
        });
    }
}
